package com.cskaoyan.service.impl;

import com.cskaoyan.bean.BaseParam;
import com.cskaoyan.bean.MarketIssue;
import com.cskaoyan.mapper.MarketIssueMapper;
import com.cskaoyan.service.MarketIssueService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (MarketIssue)表服务实现类
 *
 * @author makejava
 * @since 2021-10-18 23:41:31
 */
@Service("marketIssueService")
public class MarketIssueServiceImpl implements MarketIssueService {
    @Resource
    private MarketIssueMapper marketIssueMapper;



    /**
     * 分页查询
     *
     *
     * @return 查询结果
     */
    @Override
    public List<MarketIssue> queryByPage(String question, BaseParam param) {

        List<MarketIssue> marketIssues = marketIssueMapper.queryAllByLimit(question, param.getOrder(), param.getSort());
        return marketIssues;
    }

    /**
     * 新增数据
     *
     * @param marketIssue 实例对象
     * @return 实例对象
     */
    @Override
    public MarketIssue insert(MarketIssue marketIssue) {
        marketIssueMapper.insert(marketIssue);
        return marketIssue;
    }

    /**
     * 修改数据
     *
     * @param marketIssue 实例对象
     * @return 实例对象
     */
    @Override
    public MarketIssue update(MarketIssue marketIssue) {
        marketIssueMapper.update(marketIssue);
        return marketIssue;
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return  marketIssueMapper.deleteById(id) > 0;
    }
}
